package com.enjoy.ioc.config;

import org.springframework.beans.factory.FactoryBean;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class MyLubanDaoFactoryBean implements FactoryBean , InvocationHandler {
	Class clazz;

	public MyLubanDaoFactoryBean(Class clazz) {
		this.clazz = clazz;
	}

	@Override
	public Object getObject() throws Exception {
		return Proxy.newProxyInstance(MyLubanDaoFactoryBean.class.getClassLoader(),new Class[]{clazz},this);
	}

	@Override
	public Class<?> getObjectType() {
		return clazz;
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		System.out.println("xxxx");
		return null;
	}
}
